/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.core.database;

import java.sql.Connection;

/**
 * 
 * @author himanasser
 */
public class PooledConnection {
	private Connection connection;
	private boolean inUse = false;

	public PooledConnection(Connection connection) {
		this.connection = connection;
	}

	/**
	 * 
	 * @return
	 */
	public synchronized Connection getConnection() {
		if (!inUse) {
			inUse = true;
			return connection;
		}
		return null;
	}

	Connection _getUnderlyingConn() {
		return connection;
	}

	public synchronized void releaseConnection() {
		inUse = false;
	}

}
